package ua.com.infinite.mobile.db;

import ua.com.infinite.mobile.contentprovider.InfiniteContentProvider;
import android.content.ContentResolver;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;

public class TableUser {

	public static final String TABLE_NAME = "user";
	public static final String COLUMN_ID = "_id";
	public static final String COLUMN_SESSION = "session";	
	public static final String COLUMN_AVATAR = "avatar";
	public static final String COLUMN_FIRST_NAME = "fn";
	public static final String COLUMN_LAST_NAME = "ln";
	public static final String COLUMN_BALLANCE = "ballance";
	public static final String COLUMN_EMAIL = "email";
	public static final String COLUMN_PHONE = "phone";
	public static final String COLUMN_ACCOUNTS = "accounts";
	public static final String COLUMN_DATE = "date";
	
	public static final Uri CONTENT_URI = Uri.parse("content://" + InfiniteContentProvider.AUTHORITY + "/" + TABLE_NAME);

	public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/users";
	public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/user";
	

	public static final String CREATE_TABLE = "create table " + TABLE_NAME
			+ "(" 
			+ COLUMN_ID + " integer primary key, " 
			+ COLUMN_SESSION + " text, "
			+ COLUMN_AVATAR + " text, "
			+ COLUMN_FIRST_NAME+" text, "
			+ COLUMN_LAST_NAME+" text, "
			+ COLUMN_BALLANCE+" text, "
			+ COLUMN_EMAIL+" text, "
			+ COLUMN_PHONE+" text, "
			+ COLUMN_ACCOUNTS+" text, "
			+ COLUMN_DATE+" text"
			+");";

	public static void onCreate(SQLiteDatabase db) {
		try {
			db.execSQL(CREATE_TABLE);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

}
